import Layout from "@/views/admin/layout/Layout";

export const routes = [
  {
    path: "/admin/home",
    alias: "/admin",
    component: () => import("@/views/admin/dashboard/index.vue"),
    hidden: true
  },
  // 当有多级嵌套路由嵌套的时候，字路由切记不要用 `/` 开头，否则页面将不会被渲染
  // @see https://router.vuejs.org/zh/guide/essentials/nested-routes.html#%E5%B5%8C%E5%A5%97%E8%B7%AF%E7%94%B1
  {
    path: "/admin/article/",
    component: () => import("@/views/RouterView.vue"),
    meta: {
      icon: "article",
      title: "文章管理"
    },
    children: [
      {
        path: "/",
        component: () => import("@/views/admin/article"),
        name: "adminArticleIndex",
        meta: {
          title: "文章列表"
        }
      },
      {
        path: "edit",
        name: "adminArticleEdit",
        component: () => import("@/views/admin/article/edit"),
        hidden: true,
        meta: {
          title: "文章编辑"
        }
      }
    ]
  }
];

export default {
  path: "/admin",
  component: Layout,
  redirect: "/admin/home",
  meta: {
    title: "后台管理"
  },
  children: routes
};
